/**
 * Copyright 2012 ibiblio
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0.txt
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */


def userDir = System.properties.getProperty('user.dir')
def webserverFilesDir = userDir + '/webserver_files'

// set per-environment serverURL stem for creating absolute links
environments {
    production {
        grails.serverURL = "http://www.terasaur.org"
        terasaur.torrent.root = "/var/lib/terasaur/torrents"
        hibernate {
            cache.use_second_level_cache = true
            cache.use_query_cache = true
            cache.provider_class = 'net.sf.ehcache.hibernate.EhCacheProvider'
        }
        grails.logging.jul.usebridge = false
        /*
        dataSource {
            pooled = false
            driverClassName = "org.postgresql.Driver"
            dbCreate = "update"
            url = "jdbc:postgresql://127.0.0.1:5432/terasaur"
            username = "terasaur"
            password = "terasaur"
            dialect = "org.ibiblio.terasaur.db.TerasaurPostgreSQLDialect"
            //logSql = true
        }
        */
        grails.gsp.enable.reload = true
        grails.gsp.reload.interval = 300000 // ms
        //grails.gsp.view.dir = "/var/www/grails/my-app/" // trailing slash is required

        terasaur.web.show_error_trace = false
        weceem.upload.dir = 'file:///var/lib/terasaur/weceem_uploads'
    }
    test {
        grails.serverURL = "http://localhost:8081/"
        terasaur.torrent.root = "${webserverFilesDir}/torrents"
        hibernate {
            cache.use_second_level_cache = true
            cache.use_query_cache = true
            cache.provider_class = 'net.sf.ehcache.hibernate.EhCacheProvider'
        }
        grails.logging.jul.usebridge = false
        dataSource {
            dbCreate = "create-drop" // one of 'create', 'createeate-drop', 'update'
            url = "jdbc:hsqldb:mem:testDb;MVCC=TRUE"
        }
        grails.gsp.enable.reload = true
        grails.gsp.reload.interval = 60000 // ms
        //grails.gsp.view.dir = "/var/www/grails/my-app/" // trailing slash is required

        terasaur.web.show_error_trace = true
        weceem.upload.dir = "file://${webserverFilesDir}/weceem_uploads"
    }
    development {
        grails.serverURL = "http://localhost:8081"
        terasaur.torrent.root = "${webserverFilesDir}/torrents"
        dataSource {
            dbCreate = "create-drop" // one of 'create', 'createeate-drop', 'update'
            url = "jdbc:hsqldb:mem:devDb;MVCC=TRUE"
        }

        grails.logging.jul.usebridge = true
        grails.gsp.enable.reload = true
        grails.gsp.reload.interval = 5000 // ms

        terasaur.web.show_error_trace = true
        weceem.upload.dir = "file://${webserverFilesDir}/weceem_uploads"
    }
}

// If set to a non-empty string, this will add google analytics
// javscript integration with the given GA code.
terasaur.web.google_analytics_code = ""

// Include jQuery logging library if set to true
terasaur.web.enable_jquery_logging = false

terasaur.web.solr.url = "http://localhost:8983/solr"

// Markup sanitizer plugin config
sanitizer.trustSanitizer=true

